// Copyright (c) 2009 Mike Haight, Andy Kipp
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.

#pragma once

#include "stdafx.h"
#include "Object.h"
#include "Logger.h"
#include "Tile.h"
#include "Xml.h"

namespace HandBanana { namespace Game {

    /// <summary>
    /// 
    /// </summary>
    class Layer : public HandBanana::Core::Object, public HandBanana::Utilities::Xml::IXmlSerializable
    {
    // Constructor
    public:
        /// <summary>
        /// Create a new instance of the Layer class
        /// </summary>
        Layer(void);


    // Public Methods
    public:
        /// <summary>
        /// Get the Name of the Layer
        /// </summary>
        std::wstring Name(void) const;

        /// <summary>
        /// Get the name of the Map in the Layer
        /// </summary>
        std::wstring Map(void) const;

        /// <summary>
        /// 
        /// </summary>
        virtual Tile* GetTile(int x, int y) const;

    // IXmlSerilisable Methods
    public:
        /// <summary>
        /// Implements the IXmlSerializable::ReadXml method
        /// </summary>
        virtual void ReadXml(const HandBanana::Utilities::Xml::XmlReader &argReader);

        /// <summary>
        /// Implements the IXmlSerializable::WriteXml method
        /// </summary>
        virtual void WriteXml(const HandBanana::Utilities::Xml::XmlWriter &argWriter);

    // Private Methods
    private:
        /// <summary>
        /// 
        /// </summary>
        void LoadMap();

    // Private Data Members
    private:
        std::wstring                    mName;
        std::wstring                    mMapName;
        std::wstring                    mTilesName;
        int                             mRows;
        int                             mColumns;
        std::vector<Tile*>              mTiles;


    };

} }

